package labReport.experiment1;

import java.util.Random;
import java.util.Scanner;

public class GuessNumber {
    public static void main(String[] args) {
        int randomNumber = new Random().nextInt(10);
        System.out.print("请开始猜数字：");
        Scanner sc = new Scanner(System.in);
        while(true) {
            int inputNumber = sc.nextInt();
            if (inputNumber > randomNumber) {
                System.out.println("您猜大了，请继续猜");
            } else if (inputNumber < randomNumber) {
                System.out.println("您猜小了，请继续猜");
            } else {
                System.out.println("您猜对了");
                break;
            }
        }
    }
}
